package com.example.noval.db.mode

/**
 * @Description
 * @Author zzl
 * @Date 2024/4/1
 */
class TextChapter(
    val position: Int,
    val title: String,
    val chapterId: Int,
    val pages: List<TextPage>,
    val pageLines: List<Int>,
    val pageLengths: List<Int>,
    val chaptersSize: Int
) {

    fun page(index: Int): TextPage? {
        return pages.getOrNull(index)
    }

    val lastPage: TextPage? get() = pages.lastOrNull()

    val lastIndex: Int get() = pages.lastIndex

    val pageSize: Int get() = pages.size

    fun isLastIndex(index: Int): Boolean {
        return index >= pages.size - 1
    }
    
    
    
}